<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .wrap {
      display: flex;
      /* 主轴为交叉轴 */
      flex-direction: column;
      width: 100vw;
      height: 100vh;
      background-color: pink;
    }

    header {
      /* 不能缩放 */
      flex-shrink: 0;
      height: 50px;
      background-color: aqua;
    }

    main {
      flex: 1;
      /* 超出的部分，可以滑动 */
      overflow-y: scroll;
    }

    footer {
      flex-shrink: 0;
      height: 100px;
      background-color: greenyellow;
    }
  </style>
</head>

<body>
  <!-- 头部和底部固定，中间部分可以滑动 -->
  <div class="wrap">
    <header></header>
    <main>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
      <div>ajldfjasldfja</div>
    </main>
    <footer></footer>
  </div>

</body>

</html>